/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Servlets;

import DAO.ResourcesDAO;
import Entidades.ResourceEnt;
import Utilidades.Constantes;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;

/**
 *
 * @author 727859
 */
@WebServlet(name = "CreacionPlantillas2", urlPatterns = {"/CreacionPlantillas2"})
public class CreacionPlantillas2 extends HttpServlet {

    /**
     * Processes requests for both HTTP
     * <code>GET</code> and
     * <code>POST</code> methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       response.setContentType("text/html;charset=UTF-8");
       
       FileOutputStream outPutStream;
        byte[] bytes;
       InputStream inputStream;
        String ruta = "";
        
        try {
            OutputStream file = new FileOutputStream(new File("D:\\" + request.getParameter("asignatura") + "_" + request.getParameter("codigo") + ".pdf"));
            
            Document document = new Document();
            PdfWriter.getInstance(document, file);
            
            document.open();
            Paragraph parrafo = new Paragraph();
            parrafo.setAlignment(Paragraph.ALIGN_CENTER);
            parrafo.setFont(FontFactory.getFont("Sans", 20, Font.BOLD, BaseColor.BLUE));
            parrafo.add("Plantilla FDP71");
            try {
                //Agregamos el texto al documento
                document.add(parrafo);

                //Agregamos un salto de linea
                document.add(new Paragraph(" "));

                //Agregamos la tabla al documento haciendo 
                //la llamada al método tabla()
                document.add(tabla(request, response));
            } catch (DocumentException ex) {
                ex.getMessage();
            }
            
            document.close();
            file.close();
            
                File archivo = new File("D:\\" + request.getParameter("asignatura") + "_" + request.getParameter("codigo") + ".pdf");
                inputStream = new FileInputStream(archivo);      
                bytes = IOUtils.toByteArray(inputStream);
                response.setHeader("Content-disposition","attachment; filename="+archivo.getName());
                response.getOutputStream().write(bytes);
                response.getOutputStream().close();
            
            
            
        } catch (Exception e) {
            
            e.printStackTrace();
        }
        request.getRequestDispatcher(Constantes.MENSAJE_CREACION).forward(request, response);
    }
    
     //Método para crear la tabla
    public static PdfPTable tabla(HttpServletRequest request, HttpServletResponse response) {
        //Instanciamos una tabla de 4 columnas
        PdfPTable tabla = new PdfPTable(4);

        //Declaramos un objeto para manejar las celdas
        PdfPCell celda;

        celda = new PdfPCell(new Phrase("PROGRAMA ACADEMICO"));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("programa")));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase("ASIGNATURA"));
        celda.setColspan(2);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("asignatura")));
        celda.setColspan(2);
        tabla.addCell(celda);
        
         celda = new PdfPCell(new Phrase("CODIGO DE ASIGNATURA: "+request.getParameter("codigo")));
         celda.setColspan(2);
        tabla.addCell(celda);
        
       
        
        celda = new PdfPCell(new Phrase("GRUPO "+request.getParameter("grupo")));
        celda.setColspan(1);
        tabla.addCell(celda);
        
                
        
        celda = new PdfPCell(new Phrase("FECHA DE INICIO: "+request.getParameter("fecha")));
        celda.setColspan(1);
        tabla.addCell(celda);
        
        ////
                
         celda = new PdfPCell(new Phrase("PROFESOR: "+request.getParameter("profesor")));
        celda.setColspan(2);
        tabla.addCell(celda);
        
       celda = new PdfPCell(new Phrase("E mail: "+request.getParameter("email")));
        celda.setColspan(2);
        tabla.addCell(celda);
        
        ////
        
        celda = new PdfPCell(new Phrase("OBJETIVOS DE LA ASIGNATURA Y COMPETENCIAS QUE DESARROLLA"));
        celda.setColspan(4);
        tabla.addCell(celda);
        ////
        
        celda = new PdfPCell(new Phrase("OBJETIVO GENERAL: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("general")));
        celda.setColspan(4);
        tabla.addCell(celda);
         /////
        
        celda = new PdfPCell(new Phrase("OBJETIVOS ESPECIFICOS"));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("especifico")));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        ////
        
         celda = new PdfPCell(new Phrase("COMPETENCIAS GENERALES: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("competencias")));
        celda.setColspan(4);
        tabla.addCell(celda);
        
       ////
        
         celda = new PdfPCell(new Phrase("COMPETENCIAS GENERALES: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("competencias")));
        celda.setColspan(4);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("SUGERENCIAS PARA EL ESTUDIO DE LA ASIGNATURA: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("sugerencias")));
        celda.setColspan(4);
        tabla.addCell(celda);
        ///////
        celda = new PdfPCell(new Phrase("EVALUACION: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        celda = new PdfPCell(new Phrase(request.getParameter("evaluacion")));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        ////
        celda = new PdfPCell(new Phrase("TEMATICA O ACCION POR"
                + " DESARROLLAR: "));
        celda.setColspan(2);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("% CUMPLIDO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("CRONOGRAMA DE "
                + " AVTIVIDADES: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("111")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("112")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("113")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("121")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("122")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("123")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("131")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("132")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("133")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("141")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("142")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("143")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("151")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("152")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("153")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("161")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("162")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("163")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("171")));
        celda.setColspan(2);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("172")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("173")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ////
        celda = new PdfPCell(new Phrase("UNIDAD 1: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("unidad1")));
        celda.setColspan(3);
        tabla.addCell(celda);
        
         ////
        celda = new PdfPCell(new Phrase("TEMATICA O ACCION POR"
                + " DESARROLLAR: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("FECHA DE CUMPLIMIENTO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("% CUMPLIDO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase("EVIDENCIA DE TRABAJO"
                + " INDEPENDIENTE: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("211")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("212")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("213")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("214")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("221")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("222")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("223")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("224")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("231")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("232")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("233")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("234")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("241")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("242")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("243")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("244")));
        celda.setColspan(1);
        tabla.addCell(celda);
        
        
        ////
        celda = new PdfPCell(new Phrase("UNIDAD 2: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("unidad2")));
        celda.setColspan(3);
        tabla.addCell(celda);
        
         ////
        celda = new PdfPCell(new Phrase("TEMATICA O ACCION POR"
                + " DESARROLLAR: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("FECHA DE CUMPLIMIENTO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("% CUMPLIDO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase("EVIDENCIA DE TRABAJO"
                + " INDEPENDIENTE: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("311")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("312")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("313")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("314")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("321")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("322")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("323")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("324")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("331")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("332")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("333")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("334")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("341")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("342")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("343")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("344")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("351")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("352")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("353")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("354")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("361")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("362")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("363")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("364")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("371")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("372")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("373")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("374")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("381")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("382")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("383")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("384")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("391")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("392")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("393")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("394")));
        celda.setColspan(1);
        tabla.addCell(celda);
        
        ////
        celda = new PdfPCell(new Phrase("UNIDAD 3: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("unidad3")));
        celda.setColspan(3);
        tabla.addCell(celda);
        
         ////
        celda = new PdfPCell(new Phrase("TEMATICA O ACCION POR"
                + " DESARROLLAR: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("FECHA DE CUMPLIMIENTO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase("% CUMPLIDO: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase("EVIDENCIA DE TRABAJO"
                + " INDEPENDIENTE: "));
        celda.setColspan(1);
        tabla.addCell(celda);
        
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("411")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("412")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("413")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("414")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("421")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("422")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("423")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("424")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("431")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("432")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("433")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("434")));
        celda.setColspan(1);
        tabla.addCell(celda);
         ///
        celda = new PdfPCell(new Phrase(request.getParameter("441")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("442")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("443")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("444")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("451")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("452")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("453")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("454")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("461")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("462")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("463")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("464")));
        celda.setColspan(1);
        tabla.addCell(celda);
        ///
        celda = new PdfPCell(new Phrase(request.getParameter("471")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("472")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("473")));
        celda.setColspan(1);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("474")));
        celda.setColspan(1);
        tabla.addCell(celda);
        
         ////
        celda = new PdfPCell(new Phrase("BIBLIOGRAFIA: "));
        celda.setColspan(4);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase(request.getParameter("bibliografia")));
        celda.setColspan(4);
        tabla.addCell(celda);
        
        
        return tabla;
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP
     * <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP
     * <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
